package com.cgsrp.cgsrp_shopping.controller;

import com.cgsrp.cgsrp_shopping.service.ProductService;
import com.cgsrp.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("buy")
public class BuyController {
    @Autowired
    private ProductService productService;

    @GetMapping("list")
    public Result list(
            @RequestParam(defaultValue = "1")Integer curPage,
            @RequestParam(defaultValue = "24")Integer pageSize,
            @RequestParam(defaultValue="")String searchKey
    ){
        return productService.buyList(curPage,pageSize,searchKey);
    }
}
